﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Control_UpdateBusTypeControl : System.Web.UI.UserControl
{
    ListAndProcessData ws = new ListAndProcessData();
    private string getid = null;
    private string gettypename = null;
    private string gettotal = null;
    private string  getprice = null;
    private string getdes = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            getid = Request.QueryString["idbustype"].ToString();
            gettypename = Request.QueryString["name"].ToString();
            gettotal = Request.QueryString["total"].ToString();
            getprice = Request.QueryString["price"].ToString();
            getdes = Request.QueryString["des"].ToString();
            txtName.Text = gettypename;
            txtTotalSeats.Text = gettotal;
            txtPrice.Text = getprice;
            txtDescription.Text = getdes;
        }
    

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        bool a = false;
        string id = Request.QueryString["idbustype"].ToString();
        string typename = gettypename;
        string total = gettotal;
        string price = getprice;
        string des = getdes;
        a = ws.UpdateBusType(id, txtName.Text, txtTotalSeats.Text, txtPrice.Text, txtDescription.Text);
        if (a == true)
        {
            Response.Redirect("../Admin/showBusType_Admin.aspx");

        }
        else
        {
            Response.Redirect("Default3.aspx");
        }
    }
    protected void btnreset_Click(object sender, EventArgs e)
    {
        txtDescription.Text = "";
        txtName.Text = "";
        txtPrice.Text = "";
        txtTotalSeats.Text = "";
    }
}